<!DOCTYPE html>
<html>
<head>
<#include "common/publicMETA.ftl"/>
    <title>财务管理系统</title>
<#include "common/publicCSS.ftl"/>
<#include "common/publicHeadJS.ftl"/>

    <!-- iCheck -->
    <link rel="stylesheet" href="${ctx}/plugins/iCheck/square/blue.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="../../index2.html"><b></b>财务管理系统</a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">请登陆进入</p>

        <form id="loginform">
            <div class="form-group has-feedback">
                <input type="text" class="form-control" name="loginName" placeholder="用户">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" name="loginPwd" placeholder="密码">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-8">
                    <div class="checkbox icheck">
                        <label>
                            <input type="checkbox"> 记住我
                        </label>
                    </div>
                </div>
                <!-- /.col -->
                <div class="col-xs-4">
                    <button type="button" class="btn btn-primary btn-block btn-flat" onclick="login()">登陆</button>
                </div>
                <!-- /.col -->
            </div>
        </form>
        <!-- /.social-auth-links -->

    <#--<a href="#">忘记了密码</a><br>-->
    <#--<a href="register.html" class="text-center">注册一个新的账号</a>-->

    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<#include "common/publicFootJS.ftl"/>
<!-- iCheck -->
<script src="${ctx}/plugins/iCheck/icheck.min.js"></script>
<script src="${ctx}/js/jquery.base64.min.js"></script>
<script src="${ctx}/plugins/myplugin/form.js"></script>
<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });
    /*登陆*/
    function login() {
        var params = $("#loginform").getFormData();
        params.loginPwd = $.base64.encode(params.loginPwd);
        var index = layer.load(0, {shade: false});
        $.post("${ctx}/loginin.do",params, function (result) {
            //        result=JSON.parse(result);
            if (result.success == true) {
                layer.close(index);
                window.location.href = "${ctx}/main.html";
            } else {
                if (result.data == "user") {
                    layer.tips(result.info, $("[name='loginName']"), {time: 2000, tips: 1});
                } else if (result.data == "pwd") {
                    layer.tips(result.info, $("[name='loginPwd']"), {time: 2000, tips: 1});
                }
            }
        }, "json");
    }
</script>
</body>
</html>
